using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using CMS.Presenters.Views.Template;
using CMS.Presenters.Presenters;
using CMS.Presenters.Views;
using CMS.Core.Domain;
using CMS.Data;
using ProjectBase.Utils;

namespace CMS.Web.Template
{
    public partial class HomeThongBao : ViewUserControl, IThongBaoView
    {
        ThongBaoPresenter presenter;
        IList<CMS.Core.Domain.ThongBao> objIList;

        public HomeThongBao()
        {
            this.presenter = new ThongBaoPresenter(this, NHibernateDaoFactory.Instance.GetThongBaoDao());
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            presenter.LoadThongBaoScroll();
        }

        #region IThongBaoView Members

        public IList<CMS.Core.Domain.ThongBao> ThongBaoList
        {
            get
            {
                throw new Exception("The method or operation is not implemented.");
            }
            set
            {
                objIList = value;
                string strArticles = "<div id=\"jdArticle_scroll\" class=\"jd_news_scroll\"><ul>";                
                if (objIList != null && objIList.Count>0)
                {

                    foreach (CMS.Core.Domain.ThongBao obj in objIList)
                    {
                        strArticles += "<li>";
                        strArticles += "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">";
                        strArticles += "<tr>";
                        strArticles += "    <td valign=\"top\" width=\"6px\" style=\"padding-top:2px;\"><span style=\"font-weight: bold;color:red;\">&raquo;</span>&nbsp;</td>";
                        strArticles += "    <td valign=\"top\" align=\"left\"><a href='" + this.FullBaseUrl + "?aid=1&vid=" + obj.ID.ToString() + "' class=\"Link_Menu\">" + CUtilities.SubString(obj.TenThongBao,42) + "</a></td>";
                        strArticles += "</tr>";
                        strArticles += "</table>";
                        strArticles += "</li>";
                    }
                    strArticles += "</ul></div>";
                    tdContent.InnerHtml = strArticles;
                }
            }
        }

        public bool IsValid
        {
            get { throw new Exception("The method or operation is not implemented."); }
        }

        #endregion
    }
}